VAPI is not a constructor error (I'm using 2.5.1 l...
# support
a
I wanted to build a start button and after clicking on that I wanted to talk to vapi. I have public, private, assistance, workflow ids. But I am not being able to connect at all. here's the code i used. import React from "react"; import Vapi from "@Vapi-ai/web"; const FRONTEND_KEY = import.meta.env.VITE_VAPI_FRONTEND; const ASSISTANT_ID = import.meta.env.VITE_VAPI_ASSISTANT; export default function App() { let vapi = null; // hold the instance const startCall = async () => { vapi = new Vapi(FRONTEND_KEY); // create instance await vapi.start(ASSISTANT_ID); // start call console.log("Call started"); }; const stopCall = async () => { if (vapi) { await vapi.stop(); // stop call console.log("Call stopped"); } }; return ( <> Vapi 2.x Call Test Start Stop ); } But i keep getting error 'Vapi is not a contructor' https://cdn.discordapp.com/attachments/1444610545738055750/1444610546057084938/Screenshot_2025-11-30_102320.png?ex=694e4b69&is=694cf9e9&hm=200ae46147c1cde53d7b21eddb077aef976c346f34c0e587475624f1d0d46b0b&
c
Hi there, Thank you for your message. Our team is currently out of the office. We operate Monday through Friday, from 9:00 AM to 8:00 PM Pacific Standard Time (PST). We’ll get back to you as soon as possible during our normal business hours. If your message is urgent, please mark it accordingly or include “URGENT” in the subject line, and we’ll do our best to respond promptly. Warm regards, Vapi Customer Support Team
v
The error is caused by the import statement—make sure you use all lowercase in the package name. Replace your import with:
Copy code
javascript
import Vapi from "@vapi-ai/web";
This should resolve the "Vapi is not a constructor" error in your React app. For best results, also ensure the package is installed with
npm install @vapi-ai/web
and your environment variables are set. Source: - [Vapi Docs: Example Voice Widget](https://docs.vapi.ai/assistants/examples/docs-agent)
a
i downloaded correct package. Still not working
m
Still seems to be an issue. Opened an issue here https://github.com/VapiAI/client-sdk-react/issues/35
2 Views